from blog import app
from flask import redirect, render_template

# 导入controller，一个controller对应一个蓝图
from blog.controller.home import home
from blog.controller.account import account
from blog.controller.article import article


# 注册蓝图 第一个参数 是蓝图对象，第二个参数url前缀
app.register_blueprint(home, url_prefix='/home')
app.register_blueprint(account, url_prefix='/account')
app.register_blueprint(article, url_prefix='/article')


@app.route('/')
def index():
    return redirect('/home/index')


@app.errorhandler(404)
def page_not_found(e):
    return render_template('404.html'), 404


@app.errorhandler(500)
def internal_server_error(e):
    return render_template('500.html'), 500





